negotiator
Class Timeline

java.lang.Object
  extended by negotiator.Timeline
Direct Known Subclasses:
ContinuousTimeline, DiscreteTimeline

public abstract class Timeline
extends java.lang.Object

A time line, running from t = 0 (start) to t = 1 (deadline).


Nested Class Summary
static class Timeline.Type
          In a time-based protocol, time passes within a round.
 
Field Summary
protected  boolean hasDeadline
           
protected  boolean paused
           
 
Constructor Summary
Timeline()
           
 
Method Summary
abstract  double getCurrentTime()
           
abstract  double getTime()
          Gets the time, running from t = 0 (start) to t = 1 (deadline).
abstract  double getTotalTime()
           
 Timeline.Type getType()
           
 boolean isDeadlineReached()
           
 boolean isPaused()
           
 void pause()
          Method used to pause the timeline.
abstract  void printTime()
          Print the current time.
 void resume()
          Method used to resume the timeline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hasDeadline

protected boolean hasDeadline

paused

protected boolean paused
Constructor Detail

Timeline

public Timeline()
Method Detail

getTime

public abstract double getTime()
Gets the time, running from t = 0 (start) to t = 1 (deadline). The time is normalized, so agents need not be concerned with the actual internal clock.

Returns:
current time in the interval [0, 1].

getTotalTime

public abstract double getTotalTime()
Returns:
amount of time in seconds, or amount of rounds depending on timeline type.

getCurrentTime

public abstract double getCurrentTime()
Returns:
amount of seconds passed, or amount of rounds passed depending on the timeline type.

printTime

public abstract void printTime()
Print the current time.


isDeadlineReached

public boolean isDeadlineReached()
Returns:
true if deadline is reached.

pause

public void pause()
           throws java.lang.Exception
Method used to pause the timeline. This method is only available if it is enabled in the Global.

Throws:
java.lang.Exception

resume

public void resume()
            throws java.lang.Exception
Method used to resume the timeline. This method is only available if it is enabled in the Global.

Throws:
java.lang.Exception

getType

public Timeline.Type getType()
Returns:
type of time: Type.Time or Type.Rounds.

isPaused

public boolean isPaused()
Returns:
true if timeline is paused.